<style>
    #body{
        padding-top: 0 !important;
    }

</style>

<div id="body" class="layout">
    <div class="wrap">
        <div class="left">
            <ul class="sort-panel">
                <li class="s-text">Search events:</li>
                <li>
                    <a href="<?php echo $this->baseUrl(''); ?>">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Home
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo $this->baseUrl("event/eventupdates"); ?>" class="current selected">
                        <span class="first">
                            <span class="last">
                                <span class="middle">
                                    Event Updates
                                </span>
                            </span>
                        </span>
                    </a>
                </li>
            </ul>
            <div class="cf"></div>
            <div class="page-name">
                Event <strong>Updates</strong>
            </div>
            <div class="im-content" style="display:block;">
                <div class="im-wrap">
                    <?php
                        //pr($this->alldata);
                        $flag_arr = array();
                        $flag_arr['event_id'] = array();
                        if (!empty($this->alldata))
                        {
                            foreach ($this->alldata as $key => $value)
                            {
                                $event_image_array = getEventImages($value["event_id"]);
                                //pr($event_image_array);
                                ?>
                                <div class="msg"  >
                                    <div class="msg-left">
                                        <div class="avt"><img src="<?php echo $event_image_array[0]; ?>" alt="<?php echo stripslashes($value["event_title"]); ?>" title="<?php echo stripslashes($value["event_title"]); ?>"/></div>
                                    </div>
                                    <div class="msg-right link-to-event" style="cursor:pointer;" data-event-id ="<?php echo getEncryptedString($value['notification_event_id']); ?>" data-is-clickable="<?php echo $value['status_code']==1&&!in_array($value['notification_event_id'], $flag_arr['event_id'])? false:true; ?>">
                                        <p><a target="_blank" href="<?php echo $this->baseUrl("eventdetail/".  getEncryptedString($value['event_id'])); ?>"><strong><?php echo stripslashes($value["event_title"]); ?></strong></a></p>
                                        <?php
                                        switch ($value['status_code'])
                                        {

                                            case 1:
                                                if (!in_array($value['notification_event_id'], $flag_arr['event_id'])):
                                                    ?>
                                                    <p><?php echo $value['user_first_name'] . " " . $value['user_last_name']; ?> has requested to join event <i>"<?php echo stripslashes($value['event_title']); ?>"</i> </p>
                                                    <p><a class="rbox fr accept-link"  href="<?php echo $this->baseUrl("ajax/eventrequest/respond/accept/eventId/" . $value['event_id'] . "/ejId/".$value['ej_id']."?redirect_uri=" . curPageURL()); ?>" onclick="window.location=this.href" >Accept</a><span class='fr'>&nbsp;&nbsp;</span>
                                                        <a class="rbox fr reject-link"  href="<?php echo $this->baseUrl("ajax/eventrequest/respond/reject/ejId/" . $value['ej_id'] . "?redirect_uri=" . curPageURL()); ?>" onclick="window.location=this.href">Reject</a>
                                                    </p> 
                                                    <?php
                                                    $flag_arr['user_id'][] = $value['user_id'];
                                                else:
                                                    ?>
                                                    <p><?php echo $value['user_first_name'] . " " . $value['user_last_name']; ?> has requested to join event <i>"<?php echo stripslashes($value['event_title']); ?>"</i> </p>
                                                <?php
                                                endif;

                                                break;
                                            case 2:
                                                //if (!empty($value['notificaton_event_joiner']))
                                                if (!empty($value['notification_event_joiner']))
                                                {
                                                    ?>
                                                    <p><?php echo $value['user_first_name'] . " " . $value['user_last_name']; ?> has left event <i>"<?php echo stripslashes($value['event_title']); ?>"</i> </p>
                                                    <?php
                                                }
                                                else
                                                {
                                                    ?>
                                                    <p>You successfully left event <i>"<?php echo stripslashes($value['event_title']); ?>"<i></p>
                                                                <?php
                                                            }
                                                            break;
                                                        case 3: echo "<p>Your request for joining event <i>\"" . stripslashes($value["event_title"]) . "\"</i> has been approved</p>";
                                                            break;

                                                        case 4: echo "<p>Your request for joining event <i>\"" . stripslashes($value["event_title"]) . "\"</i> has been rejected</p>";
                                                            break;

                                                        case 5: if (!empty($value['notification_event_joiner']))
                                                                echo "<p><span class='blu'>" . $value["user_first_name"] . " " . $value["user_last_name"] . "</span> ";
                                                            else
                                                                echo "<p> you have ";
                                                            echo "successfully joined an event <i>" . stripslashes($value["event_title"]) . "</i></p>";
                                                            break;
                                                        case 6: echo "<p>" . $value["user_first_name"] . " " . $value["user_last_name"] . "</i> was successfully rejected joining an event</p>";
                                                            break;
                                                        case 7: echo "<p> You were removed from event <i>" . stripslashes($value["event_title"]) . "</i></p>";
                                                            break;
                                                        case 8: echo "<p>" . $value["user_first_name"] . " " . $value["user_last_name"] . "</i> was successfully removed from event <i>" . stripslashes($value["event_title"]) . "</i></p>";
                                                            break;

                                                        case 9: echo "<p>" . stripslashes($value["event_title"]) . " has been modified.</p>";
                                                            break;

                                                        case 10: echo "<p>" . $value["notification_message"] . "</p>";
                                                            break;
                                                        case 11: echo "<p>" . str_replace("Host",$value["user_first_name"]." ".$value["user_last_name"],$value["status_message"]) . "</p>";
                                                            break;
                                                    }
                                                    $flag_arr['event_id'][] = $value['notification_event_id'];
                                                    ?> 
                                                    <p class="time" style="color:#1C97D6;"><?php echo getTimeAgo(strtotime($value['notification_timestamp'])); ?></p>            

                                                    </div>
                                                    <div class="cf"></div>
                                                    <a href="<?php echo $this->baseUrl("event/removenotification/nId/" . $value['notification_id']); ?>" class="del-icon"><img src="<?php echo IMAGES_PATH; ?>/del-msg-icon.png" alt="del" /></a>
                                                    </div>
                                                    <?php
                                                }
                                            }
                                            else
                                            {
                                                echo "No notifications";
                                            }
                                        ?>
                                        <br /><br />


                                        </div>
                                        <?php
                                            echo $this->paginationControl($this->paginator, 'Sliding', 'pagination/pagination.phtml');
                                        ?>

                                        </div>
                                        </div>
                                        <div class="right">
                                            <?php
                                                echo $this->partial("ads.phtml", array("ads_count" => "3"));
                                            ?>
                                        </div>
                                        <div class="cf"></div>
                                        </div>
                                        </div>